package com.cms.recursoshumanos.xml.handler;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class XMLObjectHandler extends DefaultHandler {
    
	public String string_regreso;
    public String string_aux;
    boolean bfresult = false;
    
    public XMLObjectHandler()
    {
    	string_regreso = "";
        string_aux = "";
    }
    
    public String getXMLResult()
    {
    	return string_regreso;
    }
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException 
    {
		if (qName.equalsIgnoreCase("Result")) 
		{
			bfresult = true;
		}
	}
    public void endElement(String uri, String localName, String qName) throws SAXException 
    {
    	if(bfresult)
        {
    		string_regreso = string_aux.toString().trim();
            bfresult = false;
        }
    }

    public void characters(char ch[], int start, int length) throws SAXException 
    {
    	if (string_aux!=null && bfresult == true) 
    	{
            for (int i=start; i<start+length; i++) 
            {
            	string_aux = string_aux + ch[i];
            }
        }
    }

}




